<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.*"%>
<jsp:useBean id="actions" scope="application" class="DataAccess.Actions"/>
     <%
        String id_provincia = request.getParameter("id_provincia");
        String Default_Text =  "Seleziona...";
        try {
           //Class.forName("com.mysql.jdbc.Driver");
            Class.forName(actions.getDriverString());
            //Connection cn = DriverManager.getConnection ("jdbc:mysql://127.0.0.1/carta?user=root&password=");
            Connection cn = DriverManager.getConnection (actions.getConnectionString());
            
            java.sql.Statement stmt = cn.createStatement();
            String sql="SELECT id_citta, nome_citta from citta where id_provincia = " + id_provincia;
            ResultSet rs;
            
           // if (Default_ID != "0") {
           //     rs = stmt.executeQuery(sql + " where " + CampoID + "=" + Default_ID);
           //     if (rs.next()) {
           //         Default_Text = "*" + rs.getString(CampoDescrizione) + "*";
           //     }
           // }
            
            rs = stmt.executeQuery(sql);
            %>
            
                Comune: <SELECT id='id_citta' name='id_citta'>
            
            
            <option value="0"> Scegli il comune...
            <%
            while (rs.next()) {
            %>
            <option value="<%=rs.getString(1)%>"> <%=rs.getString(2)%> </option>;
            <%
            }   
            stmt.close();
            rs.close();
            cn.close();
        }
            catch (Exception e) {
                //System.out.print(showError(e));
        }
    %>
